<template>
  <div class="info-pos">
    <div>test</div>
    <button type="button" class="btn btn-primary" @click.prevent="member">member</button>
    <table class="table">
      <thead>
      <tr>
        <th scope="col">#</th>
        <th scope="col">customerPhoneNumber</th>
        <th scope="col">customerUsername</th>
        <th scope="col">member</th>
        <th scope="col">employeeNumber</th>
        <th scope="col">forbiddenTime</th>
        <th scope="col">#########</th>
      </tr>
      </thead>
      <tbody>
      <tr v-for="(item, index) in List" :key="item.customerUsername">
        <th scope="row">{{++index}}</th>
        <td>{{item.customerPhoneNumber}}</td>
        <td>{{item.customerUsername}}</td>
        <td>{{item.member}}</td>
        <td>{{item.employeeNumber}}</td>
        <td>{{item.forbiddenTime}}</td>
        <td><button type="button" class="btn btn-danger" @click.prevent="forbidden(item)">封禁</button></td>


      </tr>

      </tbody>
    </table>



  </div>
</template>

<script>
export default {
  name: 'EmployeeMain',

  data(){
    return {
      List:[]
    }
  },
  methods: {
    async member() {
      const {data: res} = await this.$http.get('/employee/member')
    },

    async getAllList() {
      const {data: res} = await this.$http.get('/employee/getAllList')
      this.List=res.data
    },
    async forbidden(item){
      const {data: res} = await this.$http.get('/employee/forbidden?customerPhoneNumber='+item.customerPhoneNumber
      +'&employeeNumber='+localStorage.getItem("username_E"))
      await this.getAllList()
    }

  },

  created() {
    this.getAllList()
  }


}
</script>

<style lang="less" scoped>

.info-pos{
  margin: 0 auto;
  width: 80rem;
  height: 200px;

}
</style>
